package com.wtwd.device.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wtwd.device.dao.SysUserMapper;
import com.wtwd.device.model.entity.SysUser;
import com.wtwd.device.model.vo.UserInfoVo;
import com.wtwd.device.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author mjy
 * @date 2021/08/03
 * @description
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;



    @Override
    public IPage<UserInfoVo> getAllUserInfoByConditions(String account, Page<Object> page) {
        return sysUserMapper.getAllUserInfoByConditions(account,page);
    }

    @Override
    public Integer updateSysUser(SysUser sysUser) {
        return sysUserMapper.updateSysUser(sysUser);
    }

    @Override
    public Integer addSysUser(SysUser sysUser) {
        return sysUserMapper.addSysUser(sysUser);
    }

    @Override
    public Integer deleteSysUser(Integer userId) {
        return sysUserMapper.deleteSysUser(userId);
    }

    @Override
    public SysUser getSysUserByAccount(String account) {
        return sysUserMapper.getSysUserByAccount(account);
    }

    @Override
    public Boolean checkLoginUser(SysUser sysUser,String password) {
        if (sysUser==null){
            return false;
        }
        if (!sysUser.getPassword().equals(password)){
            return false;
        }
        return true;
    }
}
